package com.movie.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.movie.dao.MovieDao;
import com.movie.dao.UserDao;
import com.movie.dao.impl.MovieDaoImpl;
import com.movie.entity.Movie;
import com.movie.entity.User;
import com.movie.service.UserService;

/**
 * 
 * @ClassName: MovieListView
 * @Description: 显示电影列表的页面
 * @author 左岩
 * @date 2018年12月14日 下午1:37:04
 *
 */

@WebServlet(urlPatterns = "/admin/movieList")
public class MovieListView extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		MovieDao movieDao = new MovieDaoImpl();
		List<Movie> movieList = movieDao.getAllMovie();
		
		request.setAttribute("movieList", movieList);
		request.getRequestDispatcher("/WEB-INF/page/admin/movie-list.jsp").forward(request, response);

	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
